﻿using Data0426.Base.Common;
using Data0426.Base.Dommain;
using Data0426.Base.Infrastructure;
using Data0426.Base.Read.API.Applaction.Command;
using MediatR;

namespace Data0426.Base.Read.API.Applaction.Hander
{
    public class ShowIndeshander : IRequestHandler<ShowIndesCommand, ApiResult<List<Indescs>>>
    {
        private readonly IBaseRequest<Indescs> IndescsbaseRequest;

        public ShowIndeshander(IBaseRequest<Indescs> indescsbaseRequest)
        {
            IndescsbaseRequest = indescsbaseRequest;
        }

        public Task<ApiResult<List<Indescs>>> Handle(ShowIndesCommand request, CancellationToken cancellationToken)
        {
            var result = new ApiResult<List<Indescs>>();
            var info = IndescsbaseRequest.GetAll().Where(x => x.Isdelete == 0).ToList();
            result.data = info;
            result.code = ApiEnumcode.OK;
            result.meg = "获取成功";
            return Task.FromResult(result);
        }
    }
}
